<%@page import="com.sun.java.swing.plaf.windows.WindowsBorders.DashedBorder"%>
<%@page import="java.util.Random"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%  String token = (String) session.getAttribute("token");
    String user = (String) session.getAttribute("user");
    if (user != null) {
        out.print("<script type='text/javascript'>inicioMenu();</script>");
    } else {
%>
<h1 class="title">Bienvenido al Sistema de Gesti&oacute;n de Seguridad Integral</h1>
<hr>
<p class="meta"></p>
<center>
    <h2>Iniciar Sesi&oacute;n</h2>
    <br>
    <html:form action="/AutenticarUsuario" styleId="loginForm" onsubmit="return sendLogin()">
        <html:password property="password" styleId="password" styleClass="oculta" value=""></html:password>
        <% if (request.getParameter("pwdOk") != null) {
                    out.print("<p style=\"color:blue;\">Su contrase&ntilde;a se ha cambiado exitosamente.</p>");
                }%>
        <br>
        <table>
            <tr>
                <td>Usbid:</td>
                <td><html:text property="usuario"/></td>
                <td>&nbsp;Ejemplo: pperez</td>
            </tr>
            <tr>
                <td>Contrase&ntilde;a:</td>
                <td><input type="password" id="pass"/></td>
                <td></td>
            </tr>
        </table>
        <html:errors property = "usuario_requerido"/>
        <html:errors property = "password_requerido"/>
        <html:errors property = "login_fallido"/>

        <html:submit styleClass="button" value="Entrar"/>
        <html:cancel styleClass="button" value="Cancelar"/>
    </html:form>
    <br>
    <a href="javascript:void(0);" id="recordarPwd">Recordar Contraseña</a>
    <br><br>
</center>
<script type="text/javascript">
    $('#recordarPwd').click(recordarPwdMenu);
    function sendLogin(){
        login(<% out.print(token);%>);
        return false;
    }
    function recordarPwdMenu(){
        $('#center').load('Templates/recordarPassword.jsp');
    }
</script>
<% }%>